const crypto = require('crypto')
const {argv} = require('yargs')
const {mongoose} = require('../core/mongodb')
const autoIncrement = require('mongoose-auto-increment')
const articleSchema=new mongoose.Schema({
    title:{type:String,required:true,default:''},
    isTop:{type:Boolean,required:true,default:false},
    isEnable:{type:Boolean,required:true,default:false},
    views:{type:Number,required:true,default:0},
    likes:{type:Number,required:true,default:0},
    comments:{type:Array,required:true,default:[]},
    cover:{type:String,required:true,default:''},
    createBy:{type:Object,required:true,default:{userName:'',userId:''}},
    content:{type:String,required:true,default:''},
    tags:{type:Array,required:true,default:[]},
    category:{type:Object,required:true,default:{categoryId:'',categoryName:''}},
    create_time:{type:Date,default:Date.now},
    update_time:{type:Date,default:Date.now}
})
// articleSchema.plugin(autoIncrement.plugin,'ARTICLE')
module.exports=mongoose.model('ARTICLE',articleSchema,'ARTICLE')
